#### SENSITIVITY TEST: Including candidates of all parties ####
primary_all <- dime %>%
  filter(!is.na(ppct)) %>%
  filter(num_prim_opps > 1,
         ppct != 100,
         ppct != 0)

general_all <- dime %>%
  filter(!is.na(gpct)) %>%
  filter(gpct != 100,
         gpct != 0)

# Primary congressional elections
mod_all_primary <- lm(form_primary_main,
                      data = primary_all)

primaryr2 <- get_r2(mod_all_primary)
mod_all_primary <- get_clusters(mod_all_primary)

# General congressional elections
mod_all_general <- lm(form_general_main,
                      data = general_all)

generalr2 <- get_r2(mod_all_general)
mod_all_general <- get_clusters(mod_all_general)


stargazer(mod_all_general, mod_all_primary,
          type = "latex",
          title = "Relationship Between Name Fluency and Vote Share",
          style = style,
          star.cutoffs = star.cutoffs,
          star.char = star.char,
          column.labels = column.labels,
          keep.stat = keep.stat,
          notes = notes,
          keep = keep_congress,
          covariate.labels = covariate.labels_congress,
          font.size = "footnotesize",
          model.names = F,
          add.lines=list(c("Year FE", "\\checkmark", "\\checkmark"),
                         c("State FE", "\\checkmark", "\\checkmark"),
                         c("N", get_n(mod_all_general), get_n(mod_all_primary)),
                         c("Adj. R-squared", generalr2, primaryr2)),
          out = "tables/reg-all-parties.tex",
          label = "tab:reg-all-parties")


